package com.yfqy.admin.domain.dto.promotion;

import jakarta.validation.constraints.Future;
import jakarta.validation.constraints.FutureOrPresent;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
public class ProductPromotionDTO {

    // 促销活动id，编辑时不能为空
    private Long id;

    @NotBlank(message = "活动名称不能为空")
    @Size(max = 128, message = "活动名称长度不能超过128个字符")
    private String name;

    @NotNull(message = "商品ID不能为空")
    private Long spuid;

//    @NotEmpty(message = "请选择sku")
    private List<String> skuids;

    @NotNull(message = "活动类型不能为空")
    @Range(min = 1, max = 4, message = "活动类型不合法")
    private Integer type;

    @NotNull(message = "开始时间不能为空")
    @FutureOrPresent(message = "开始时间必须大于等于当前时间")
    private Date startTime;

    @NotNull(message = "结束时间不能为空")
    @Future(message = "结束时间必须大于当前时间")
    private Date endTime;

//    @NotNull(message = "促销价格不能为空")
//    @DecimalMin(value = "0.01", message = "促销价格必须大于0")
    private BigDecimal promotionPrice;

    @Min(value = 1, message = "促销库存必须大于0")
    private Integer promotionStock = 1;

    @Min(value = -1, message = "限购数量不能小于-1")
    private Integer purchaseLimit = -1;

    @NotEmpty(message = "活动配置不能为空")
    private List<PromotionConfDTO> promotionConfDTOS;
}
